#include <pio.h>
#include <std.h>
#include <error.h>
#include <type.h>

#define DMA10addr 0
#define DMA10coun 1
#define DMA11addr 2
#define DMA11coun 3
#define DMA12addr 4
#define DMA12coun 5
#define DMA13addr 6
#define DMA13coun 7

#define DMA20addr 0xc0
#define DMA20coun 0xc2
#define DMA21addr 0xc4
#define DMA21coun 0xc6
#define DMA22addr 0xc8
#define DMA22coun 0xca
#define DMA23addr 0xcc
#define DMA23coun 0xce

#define page0 0x87
#define page1 0x83
#define page2 0x81
#define page3 0x82

#define page4 0x8f
#define page5 0x8b
#define page6 0x89
#define page7 0x8a

//Mode register:

//Control Byte bit definitions
//Mode Selection Bits 7:6
#define DemandMode  0    //00
#define SingleMode  64   //01
#define BlockMode   128  //10
#define CascadeMode 192  //11
//Address Increment/Decrement bit 5
#define AddressDecrement  32 //1
#define AddressIncrement  0  //0
//AutoInitialization enable bit 4
#define AutoInit    16 //1
#define SingleCycle 0  //0
//Transfer Type bits 3:2
#define VerifyTransfer 0  //00
#define WriteTransfer  4  //01
#define ReadTransfer   8 //10

#define BUFFSIZE        8192
#define HALFBUFFSIZE    4096

#define CHAN0_4	0
#define CHAN1_5 1
#define CHAN2_6 2
#define CHAN3_7 3

#define WRITEMODEDMA1 0x0b
#define WRITEMODEDMA2 0xd6

//Single mask register:

#define CLEARMASK 0
#define SETMASK 4

#define SINGLEMASKDMA1 0x0a
#define SINGLEMASKDMA2 0xd4

#define CLEARBPFF1 0x0c
#define CLEARBPFF2 0xd8

#define LoByte(x)(short)(x & 0x00FF)
#define HiByte(x)(short)((x&0xFF00)>>8)

